package cn.lcsjsxy.yxz.kind.comprehensiveexercises.object;

public class Circle extends GeometricObject{

    //初始化对象的color属性为“white"，welkght属性为1.0，radius属性为1.0。
    //初始化对象的color属性为“white”，weight属性为1.0，radlus根据参数构造器确定
    //重写equals方法,比较两个圆的半径是否相等，如相等，返Ciue。
    //重写tostring方法,输出圆的半径。

    //object

    private double radius;

    public Circle(double v, String white, double radius) {
        super();
        this.radius = 1.0;
//        color = "white";
//        weight = 1.0;
    }

    public Circle(double radius) {
        super();
        this.radius = radius;
    }
    public Circle(String color, double weight, double radius) {
        super(color, weight);
        this.radius = radius;
    }

    public double getRadius() {
        return radius;
    }

    public void setRadius(double radius) {
        this.radius = radius;
    }
    //面积
    public double findArea(){
        return 3.14 * radius * radius;
    }

    @Override
    public boolean equals(Object obj){
        if (this == obj){
            return true;
        }
        if (obj instanceof Circle){
            Circle c = (Circle)obj;
            return this.radius == c.radius;
        }
        return false;
    }

    @Override
    public String toString() {
        return "Circle{" + "radius=" + radius + '}';
    }
}
